/**
 * 
 */
package projeto.administrativo.colaboradorexterno.cgd;

import javax.persistence.Query;

import org.springframework.stereotype.Repository;

import plataforma.crudestatico.cgd.DaoBase;
import projeto.administrativo.colaboradorexterno.cdp.ColaboradorExterno;

/**
 * @author mike
 * 
 */
@Repository
public class DaoColaboradorExterno extends DaoBase<ColaboradorExterno> {

	@Override
	public ColaboradorExterno recuperarPorId(Long id) {
		String hql = "select distinct c from ColaboradorExterno c "				
				+ " left outer join fetch c.funcaoServico"
				+ " left outer join fetch c.contatos"
				+ " left outer join fetch c.informacoes" 
				+ " where c.id=:parId";

		Query query = getEntityManager().createQuery(hql);
		query.setParameter("parId", id);

		return (ColaboradorExterno) query.getSingleResult();
	}

}
